package uk.ac.glasgow.demosocs.impl;

import java.io.Serializable;

import uk.ac.glasgow.demosocs.*;

/**
 * @author Tsvetelina, Bilal
 * 
 * Implementation of candidate.
 * This class implements candidate and serializable.
 * 
 * A candidate is a person nominated for an election.
 * 
 */

public class CandidateImpl implements Candidate, Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private String forename, surname, GUID;

	/**
	 * Creates a new candidate.
	 * 
	 * @param forename
	 * @param surname
	 * @param GUID
	 * 		  This is the matric for a candidate e.g. 0912345
	 */

	public CandidateImpl(String forename, String surname, String GUID, String EID) {
		this.forename = forename;
		this.surname = surname;
		this.GUID = GUID;
	}
	/**
	 * Creates a new candidate.
	 * 
	 * @param GUID
	 * 		  This is the matric for a candidate e.g. 0912345
	 */
	public CandidateImpl(String GUID) {
		this.GUID = GUID;

	}
	

	/**
	 * setters
	 */

	private void setCandidateForename(String forename) {
		this.forename = forename;
	}

	private void setCandateSurname(String surname) {
		this.surname = surname;
	}

	private void setCandidateGUID(String GUID) {
		this.GUID = GUID;
	}

	/**
	 * getters
	 */

	public String getCandidateForename() {
		return forename;
	}

	public String getCandidateSurname() {
		return surname;
	}

	public String getGUID() {
		return GUID;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((GUID == null) ? 0 : GUID.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CandidateImpl other = (CandidateImpl) obj;
		if (GUID == null) {
			if (other.GUID != null)
				return false;
		} else if (!GUID.equals(other.GUID))
			return false;
		return true;
	}
	@Override
	public String getDisplayableDescription() {
		return GUID;
	}
	

}
